Day 3 - Showing the content of a file
Solutions to exercises
Exercise 3.01
Print the content of the file examples.txt numbering lines.
Solution
According to the man page of cat the -n option numbers all output lines. So
$ cat -n examples.txt
1
dog
2
cat
3
elephant
4
ostrich
5
Dug the Dog
[...]
gives the desired result.
Go back to the exercise
Exercise 3.02
Check if the file examples.txt contains spaces at the end of any line.
Solution
According to the man page of cat the -E option displays $ at the end of each line. So